<template>
	<view>
		<view class="prBox">
			<view v-if="objList.facilityId">
				<!-- 设备 -->
				<view class="boxItem mb20">
					<view class="flex mb20" v-if="objList.unitName">
						<view class="name w170">所属单位：</view>
						<view class="value">{{objList.unitName}}</view>
					</view>
					<view class="flex mb20" v-if="objList.facilityTypeDesc">
						<view class="name w170">类别：</view>
						<view class="value">{{objList.facilityTypeDesc}}</view>
					</view>
					<view class="flex mb20" v-if="objList.facilityName">
						<view class="name w170">设备名称：</view>
						<view class="value">{{objList.facilityName}}</view>
					</view>
					<view class="flex mb20" v-if="objList.facilityId">
						<view class="name w170">设备编号：</view>
						<view class="value">{{objList.facilityId}}</view>
					</view>
					<view class="flex mb20" v-if="objList.facilityModel">
						<view class="name w170">规格型号：</view>
						<view class="value">{{objList.facilityModel}}</view>
					</view>
					<view class="flex mb20" v-if="objList.productionDate">
						<view class="name w170">出厂日期：</view>
						<view class="value">{{objList.productionDate}}</view>
					</view>
					<view class="flex mb20" v-if="objList.productionCode">
						<view class="name w170">出厂编号：</view>
						<view class="value">{{objList.productionCode}}</view>
					</view>
					<view class="flex mb20" v-if="objList.manufacturer">
						<view class="name w170">生产厂家：</view>
						<view class="value">{{objList.manufacturer}}</view>
					</view>
					<view class="flex mb20" v-if="objList.facilityStatusDesc">
						<view class="name w170">设备状态：</view>
						<view class="value">{{objList.facilityStatusDesc}}</view>
					</view>
					<!-- <view class="flex mb20">
						<view class="name w170">责任人：</view>
						<view class="value">何卫军</view>
					</view>
					<view class="flex mb20">
						<view class="name w230">责任人联系电话：</view>
						<view class="value">18882118152</view>
					</view> -->
				</view>
				<!-- 检验 -->
				<view class="boxItem mb20" v-if="objList.inspectionInfo">
					<view class="flex mb20" v-if="objList.inspectionInfo.inspectionMaintenanceUnitName">
						<view class="name w170">检验单位：</view>
						<view class="value">{{objList.inspectionInfo.inspectionMaintenanceUnitName}}</view>
					</view>
					<view class="flex mb20" v-if="objList.inspectionInfo.inspectionMaintenanceDate">
						<view class="name w170">检验时间：</view>
						<view class="value">{{objList.inspectionInfo.inspectionMaintenanceDate | dateStr}}</view>
					</view>
					<view class="flex mb20" v-if="objList.inspectionInfo.inspectionMaintenancePrName">
						<view class="name w170">检验负责人：</view>
						<view class="value">{{objList.inspectionInfo.inspectionMaintenancePrName}}</view>
					</view>
					<view class="flex mb20" v-if="objList.inspectionInfo.inspectionMaintenanceContent">
						<view class="name w170">检验内容：</view>
						<view class="value">{{objList.inspectionInfo.inspectionMaintenanceContent}}</view>
					</view>
					<view class="flex mb20">
						<view class="name w170">附件：</view>
						<view class="cob" @click="preview(objList.inspectionInfo.id)">查看</view>
					</view>
					<view class="flex mb20" v-if="objList.inspectionInfo.nextInspectionMaintenanceDate">
						<view class="name w230">下次检验时间：</view>
						<view class="value">{{objList.inspectionInfo.nextInspectionMaintenanceDate | dateStr}}</view>
					</view>
					<view class="mtb20">
						<u-line color="#F5F6F9"></u-line>
					</view>
					<view class="cob flex flex-end" @click="toMore('01')">更多></view>
				</view>
				<!-- 保养 -->
				<view class="boxItem mb20" v-if="objList.maintenanceInfo">
					<view class="flex mb20" v-if="objList.maintenanceInfo.inspectionMaintenanceUnitName">
						<view class="name w170">保养单位：</view>
						<view class="value">{{objList.maintenanceInfo.inspectionMaintenanceUnitName}}</view>
					</view>
					<view class="flex mb20" v-if="objList.maintenanceInfo.inspectionMaintenanceDate">
						<view class="name w170">保养时间：</view>
						<view class="value">{{objList.maintenanceInfo.inspectionMaintenanceDate | dateStr}}</view>
					</view>
					<view class="flex mb20" v-if="objList.maintenanceInfo.inspectionMaintenancePrName">
						<view class="name w170">保养负责人：</view>
						<view class="value">{{objList.maintenanceInfo.inspectionMaintenancePrName}}</view>
					</view>
					<view class="flex mb20" v-if="objList.maintenanceInfo.inspectionMaintenanceContent">
						<view class="name w170">保养内容：</view>
						<view class="value">{{objList.maintenanceInfo.inspectionMaintenanceContent}}</view>
					</view>
					<view class="flex mb20"><!-- v-if="objList.maintenanceInfo.annex" -->
						<view class="name w170">附件：</view>
						<view class="cob" @click="preview(objList.maintenanceInfo.id)">查看</view>
					</view>
					<view class="flex mb20" v-if="objList.maintenanceInfo.nextInspectionMaintenanceDate">
						<view class="name w230">下次保养时间：</view>
						<view class="value">{{objList.maintenanceInfo.nextInspectionMaintenanceDate | dateStr}}</view>
					</view>
					<view class="mtb20">
						<u-line color="#F5F6F9"></u-line>
					</view>
					<view class="cob flex flex-end" @click="toMore('02')">更多></view>
				</view>
			</view>
		</view>
		<view class="maintenance">
			<image src="../../static/addMaintain.png" @click="toEqAdd"></image>
			<view>添加保养</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				objList: {},
				devID:''
			}
		},
		onLoad(e) {
			if (e.devID) {
				this.devID = e.devID
				console.log(e.devID)
			}
		},
		filters:{
			dateStr(e){
				return e ? e.slice(0, 10) : ''
			}
		},
		onShow() {
			this.list()
		},
		methods: {
			list(){
				let that = this
				that.request(that.$api.getDetail+ that.devID, {},'GET').then((res) => {
					console.log(1,res)
					if(res.resultValue){
						that.objList = res.resultValue
					}
				})
			},
			//添加保养
			toEqAdd() {
				// uni.navigateTo({
				// 	url: "./equipmentAdd/equipmentAdd?facilityId="
				// })
				if (this.objList.facilityId) {
					uni.navigateTo({
						url: "./equipmentAdd/equipmentAdd?facilityId="+this.objList.facilityId
					})
				}
			},
			//跳转更多
			toMore(e) {
				uni.navigateTo({
					url: "./equipmentMore?messageType="+e+"&qrCode="+this.objList.facilityId
				})
			},
			//预览附件支持doc, xls, ppt, pdf, docx, xlsx, pptx
			preview(e) {
				uni.navigateTo({
					url: './../checkTheAttachment/checkTheAttachment?classify=' + '0503' + '&connectId=' + e
						
				})
			}
		}
	}
</script>


<style scoped>
	.prBox {
		min-height: 100vh;
		box-sizing: border-box;
		background-color: #F5F6F9;
		padding: 28rpx;
		padding-bottom: 228rpx;
	}

	.maintenance {
		background-color: #FFFFFF;
		position: fixed;
		bottom: 0;
		height: 228rpx;
		width: 100%;
		box-shadow: 0 -1px 11px 0 rgba(0, 0, 0, 0.09);
		text-align: center;
		padding: 40rpx;
		box-sizing: border-box;
	}

	.maintenance image {
		width: 84rpx;
		height: 84rpx;
	}

	.maintenance view {
		font-family: PingFangSC-Regular;
		font-weight: Regular;
		font-size: 28rpx;
		color: #65717D;
	}

	.boxItem {
		padding: 30rpx;
		background-color: #fff;
		box-shadow: 0 2px 4px 0 rgba(237, 237, 237, 0.50);
		border-radius: 16rpx;
	}

	.grade {
		text-align: center;
		width: 64rpx;
		border-radius: 4rpx;
		margin-right: 20rpx;
	}

	.w170 {
		width: 170rpx;
	}

	.w230 {
		width: 230rpx;
	}

	.w150 {
		width: 150rpx;
	}

	.name {
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #89939E;
		padding-right: 20rpx;
	}

	.value {
		flex: 1;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #333333;
	}

	.cob {
		flex: 1;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #3473F9;
	}

	.time {
		margin-left: 10rpx;
		font-size: 24rpx;
		color: #939EA8;
	}
</style>
